<template>
	<view class="box">
		<view @click="retur" class="daohang">
			<text>返回</text>
		</view>
		<view class="jjgg">


			<view class="sosuo">
				<view class="dizhi">
					<text class="dizhihihi">{{dangqian}}</text>
					<text class="ri-arrow-right-s-line xiangyou"></text>
				</view>
				<view class="sosuo">
					<text class="ri-search-2-line so"></text>
					<input class="weui-input" auto-focus placeholder="搜索" />
				</view>
			</view>
		</view>
		<view class="page-body">
            <view class="page-section page-section-gap">
                <map 
				layer-style style="width: 100%; 
				height: 300px;" 
				:anchor={x:.5,y:1}
				:enable-traffic="true"
				:enable-poi="true"
				:latitude="latitude"
				:longitude="longitude"
				:markers="covers"
				  >
                </map>
            </view>
        </view>
		<view class="biejingse">
			<view class="dainmandizhi" v-for="(v,i,index) in arr" :key="index">
				<view class="left">
					<text class="namert">{{v.storname}}</text>
					<image class="tuimage" src="../../static/image/kiye.jpg" mode=""></image>
					<view class="dishfusd">
						<text class="ri-map-pin-line biao"></text>
						<text class="dizhiksf">{{v.storeurl}}</text>
					</view>
					<view class="dishfusd">
						<text class="ri-map-pin-time-line biao"></text>
						<text class="dizhiksf">10:00-22:30</text>
					</view>
					<view class="jjjj">
						<text class="waimaiudu">营业中</text>
						<text class="waimaiudu">可外卖</text>
					</view>
				</view>
				<text class="shuxian"></text>
				<view class="right">
					<text class="quxiadan" @click="xiadian">去下单</text>
					<text class="juliduoshao">距离{{v.juli}}m</text>
					<view class="disudian">
						<text class="ri-phone-line bodaduianhua" @click="bodadianhau"></text>
						<text class="ri-map-pin-fill cahkanweizhi"></text>
					</view>
				</view>
			</view>
		</view>
		<view class="zhanwewewn">

		</view>
		<!-- <view class="page-body">
			<view class="page-section page-section-gap">
				<map id="map1" ref="map1" style="width: 100%; height: 300px;" :latitude="latitude"
					:longitude="longitude">
				</map>
			</view>
		</view>
		<view class="page-body">
		            <view class="page-section page-section-gap">
		                <map style="width: 100%; height: 300px;" 
						:latitude="latitude"
						 :longitude="longitude"
						  :markers="covers">
		                </map>
		            </view> 
		        < </view> -->
	</view>
</template>
<script>
	export default {
		data() {
			return {
				// 当前的店名
				dangqian: '天府三街',
				// 	// 地图
				id: 0, // 使用 marker点击事件 需要填写id
				title: 'map',
				latitude:0,
				longitude: 0,
				covers: [{
									// id:1,
									latitude: 30.57447,
									longitude: 103.92377,
									iconPath:'../../static/image/dfan.jpg',
									height:'40rpx',
									width:'40rpx',
									callout: {//配置气泡，配置气泡后，title会失效
										content: '我的位置',
										display: 'ALWAYS',//显示方式，可以配置点击或一直显示，BYCLICK点击显示
										padding: '2',//文本边缘留白，文字和边界宽度
										bgColor: "#f5f5f5"//背景颜色
									}
								}, 
								{
									// id:2,
									latitude: 30.57447,
									longitude: 103.72377,
									iconPath:'../../static/image/dfan.jpg',
									height:'40rpx',
									width:'40rpx',
									callout: {//配置气泡，配置气泡后，title会失效
										content: '商家位置',
										display: 'ALWAYS',//显示方式，可以配置点击或一直显示，BYCLICK点击显示
										fontSize:'20rpx',
										padding: '3',//文本边缘留白，文字和边界宽度
										bgColor: "#f5f5f5"//背景颜色
									}
								}],

				 // covers: [{
				 //                latitude: 39.909,
				 //                longitude: 116.39742,
				 //                iconPath: '../../static/image/dfan.jpg'
				 //            }, {
				 //                latitude: 39.90,
				 //                longitude: 116.39,
				 //                iconPath: '../../static/image/dfan.jpg'
				 //            }],
				arr: []
			}
		},
		methods: {
			// 获取地图的经纬读函数
			dizhihanshu() {
				uni.getLocation({
					type: 'wgs84',
					success: (res)=> {
					console.log('当前位置的经度：',  res.latitude);
					console.log('当前位置的纬度：', res.longitude);
						this.covers[0].latitude=res.latitude;
						this.covers[0].longitude=res.longitude;
						this.latitude = res.latitude;
						this.longitude = res.longitude;
						
					}
				});
			},
			retur() {
				uni.switchTab({
					url: '/pages/Home/home',
				});
			},
			// 下单跳转函数
			xiadian() {
				uni.switchTab({
					url: '/pages/Order/order',
				});
			},
			// 查询函数
			query() {
				this.$ajax({
					url: '/pages/home/store',
				}).then((res) => {

					this.arr = res.data.data
					this.dangqian = this.arr[0].storname
					// console.log(this.arr)
				})
			},
			// 地图跳转页面
			dizhi(){
				uni.navigateTo({
					url:'/pages/Home/ditu'
				})
			},
			bodadianhau() {
				uni.makePhoneCall({
					phoneNumber: '13094598205',
					success: function(res) {
						// console.log(res)
					}
				})
			}

		},
		onLoad() {
			this.query(),
			this.dizhihanshu()
		}
	}
</script>
<style lang="less">
	.box {
		widows: 750rpx;
		background-color: #f5f5f5;

		.daohang {
			width: 750rpx;
			height: 200rpx;
			display: flex;
			justify-content: left;
			background-color: #FFFFFF;

			text {
				display: block;
				width: 100rpx;
				height: 50rpx;
				text-align: left;
				margin-top: 100rpx;
				font-size: 30rpx;
				font-weight: bold;
				margin-left: 40rpx;
			}
		}

		.jjgg {
			width: 750rpx;
			background-color: #FFFFFF;
			height: 100rpx;
		}

		.sosuo {
			width: 680rpx;
			height: 100rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin: 0 auto;

			.dizhi {
				width: 480rpx;
				height: 100rpx;

				.dizhihihi {
					font-size: 35rpx;
					font-weight: bold;
					margin-left: 20rpx;
					line-height: 100rpx;
				}

				.xiangyou {
					font-size: 35rpx;
					font-weight: bold;
					margin-left: 10rpx;
					line-height: 100rpx;

				}
			}

			.sosuo {
				width: 160rpx;
				height: 60rpx;
				position: relative;
				border: 1rpx solid #f5f5f5;
				background-color: #f5f5f5;
				border-radius: 50rpx;
				text-align: center;

				.so {
					width: 28rpx;
					height: 28rpx;
					font-size: 30rpx;
					line-height: 28rpx;
					margin-left: 30rpx;

				}

				input {
					font-size: 21rpx;
					text-align: center;
				}
			}


		}

		.biejingse {
			width: 750rpx;
			background-color: #f5f5f5;

			.dainmandizhi {
				width: 684rpx;
				height: 304rpx;
				border: 1rpx solid #007f61;
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin: 0 auto;
				border-radius: 20rpx;
				background-color: #FFFFFF;
				margin-top: 35rpx;

				text {
					display: block;
				}

				.left {
					width: 380rpx;
					height: 230rpx;
					margin-left: 30rpx;

					.namert {
						width: 320rpx;
						height: 40rpx;
						font-size: 37rpx;
						color: #000;
						font-weight: bold;
					}

					.tuimage {
						width: 367rpx;
						height: 40rpx;
						border-radius: 10rpx;
						margin-top: 20rpx;
					}

					.dishfusd {
						width: 320rpx;
						height: 40rpx;
						display: flex;
						font-size: 26rpx;
						display: flex;
						align-items: center;
						// margin-top: 6rpx;

						.biao {
							line-height: 40rpx;
							font-size: 26rpx;
						}

						.dizhiksf {
							font-size: 18rpx;
							width: 320rpx;
							height: 40rpx;
							overflow: hidden;
							display: -webkit-box;
							text-overflow: ellipsis;
							-webkit-line-clamp: 1;
							-webkit-box-orient: vertical;
							line-height: 40rpx;
						}
					}

					.jjjj {
						display: flex;
					}

					.waimaiudu {
						display: block;
						width: 108rpx;
						height: 50rpx;
						border-radius: 10rpx;
						background-color: #007f61;
						// margin-top: 11rpx;
						font-size: 25rpx;
						color: #FFFFFF;
						text-align: center;
						line-height: 50rpx;
						margin-right: 10rpx;
					}
				}

				.shuxian {
					display: block;
					width: 1rpx;
					height: 230rpx;
					background-color: #f0f0f0;
				}

				.right {
					width: 190rpx;
					height: 230rpx;
					margin-right: 30rpx;

					.quxiadan {
						display: block;
						font-size: 30rpx;
						width: 190rpx;
						height: 32rpx;
						color: #96ccc0;
						font-weight: bold;
						letter-spacing: 5rpx;
						text-align: center;
						margin-top: 26rpx;
					}

					.juliduoshao {
						display: block;
						width: 190rpx;
						height: 32rpx;
						font-size: 23rpx;
						color: #dddddd;
						text-align: center;
						margin-top: 26rpx;
					}

					.disudian {
						display: flex;
						justify-content: space-around;
						width: 190rpx;
						height: 80rpx;
						margin-top: 26rpx;

						.bodaduianhua {
							display: block;
							width: 65rpx;
							height: 65rpx;
							background-color: #f0f2f1;
							border-radius: 50%;
							text-align: center;
							line-height: 65rpx;
							color: #000;
						}

						.cahkanweizhi {
							display: block;
							width: 65rpx;
							height: 65rpx;
							background-color: #f0f2f1;
							border-radius: 50%;
							text-align: center;
							line-height: 65rpx;
							color: #000;
						}
					}
				}
			}
		}

		.zhanwewewn {
			width: 750rpx;
			height: 50rpx;
		}
	}
</style>
